﻿Public Class ContrastGlowOperation
    Inherits ImageOperationBase
    Private _color As Color
    Private _height As Integer
    Public Sub New(ByVal Color As Color)
        _color = Color
    End Sub
    Public Overrides Sub ExecuteExtension(ByRef g As System.Drawing.Graphics, ByRef b As System.Drawing.Bitmap)
        Dim lightest As Color = ControlPaint.Light(_color, 1.5F)
        Dim light As Color = ControlPaint.Light(_color, 1.0F)
        Dim darkest As Color = ControlPaint.Light(_color, 0.5F)
        Dim dark As Color = ControlPaint.Light(_color, 0.0F)

        Dim lightbrush As New LinearGradientBrush(New Rectangle(0, 0, 1, b.Height / 2), lightest, light, LinearGradientMode.Vertical)
        Dim darkbrush As New LinearGradientBrush(New Rectangle(b.Height / 2 + 1, 0, 1, b.Height / 2), dark, darkest, LinearGradientMode.Vertical)
        g.FillRectangle(lightbrush, New Rectangle(0, 0, b.Width, b.Height / 2))
        g.FillRectangle(darkbrush, New Rectangle(0, b.Height / 2, b.Width, b.Height / 2))
    End Sub
End Class